home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
scan.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
8KB
|
199 lines
ssssccccaaaannnn((((nnnn)))) TTTTccccllll (((( )))) ssssccccaaaannnn((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
scan - Parse string using conversion specifiers in the style
of sscanf
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
ssssccccaaaannnn _s_t_r_i_n_g _f_o_r_m_a_t _v_a_r_N_a_m_e ?_v_a_r_N_a_m_e ...?
_________________________________________________________________
IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN
This command parses fields from an input string in the same
fashion as the ANSI C ssssssssccccaaaannnnffff procedure and returns a count
of the number of fields sucessfully parsed. _S_t_r_i_n_g gives
the input to be parsed and _f_o_r_m_a_t indicates how to parse it,
using %%%% conversion specifiers as in ssssssssccccaaaannnnffff. Each _v_a_r_N_a_m_e
gives the name of a variable; when a field is scanned from
_s_t_r_i_n_g the result is converted back into a string and
assigned to the corresponding variable.
DDDDEEEETTTTAAAAIIIILLLLSSSS OOOONNNN SSSSCCCCAAAANNNNNNNNIIIINNNNGGGG
SSSSccccaaaannnn operates by scanning _s_t_r_i_n_g and _f_o_r_m_a_t_S_t_r_i_n_g together.
If the next character in _f_o_r_m_a_t_S_t_r_i_n_g is a blank or tab then
it is ignored. Otherwise, if it isn't a %%%% character then it
must match the next non-white-space character of _s_t_r_i_n_g.
When a %%%% is encountered in _f_o_r_m_a_t_S_t_r_i_n_g, it indicates the
start of a conversion specifier. A conversion specifier
contains three fields after the %%%%: a ****, which indicates that
the converted value is to be discarded instead of assigned
to a variable; a number indicating a maximum field width;
and a conversion character. All of these fields are
optional except for the conversion character.
When ssssccccaaaannnn finds a conversion specifier in _f_o_r_m_a_t_S_t_r_i_n_g, it
first skips any white-space characters in _s_t_r_i_n_g. Then it
converts the next input characters according to the
conversion specifier and stores the result in the variable
given by the next argument to ssssccccaaaannnn. The following
conversion characters are supported:
dddd The input field must be a decimal integer. It is
read in and the value is stored in the variable as
a decimal string.
oooo The input field must be an octal integer. It is
read in and the value is stored in the variable as
a decimal string.
xxxx The input field must be a hexadecimal integer. It
is read in and the value is stored in the variable
Page 1 (printed 7/17/95)
ssssccccaaaannnn((((nnnn)))) TTTTccccllll (((( )))) ssssccccaaaannnn((((nnnn))))
as a decimal string.
cccc A single character is read in and its binary value
is stored in the variable as a decimal string.
Initial white space is not skipped in this case,
so the input field may be a white-space character.
This conversion is different from the ANSI
standard in that the input field always consists
of a single character and no field width may be
specified.
ssss The input field consists of all the characters up
to the next white-space character; the characters
are copied to the variable.
eeee or ffff or gggg
The input field must be a floating-point number
consisting of an optional sign, a string of
decimal digits possibly con taining a decimal
point, and an optional exponent consisting of an eeee
or EEEE followed by an optional sign and a string of
decimal digits. It is read in and stored in the
variable as a floating-point string.
[[[[_c_h_a_r_s]]]] The input field consists of any number of
characters in _c_h_a_r_s. The matching string is
stored in the variable. If the first character
between the brackets is a ]]]] then it is treated as
part of _c_h_a_r_s rather than the closing bracket for
the set.
[[[[^^^^_c_h_a_r_s]]]] The input field consists of any number of
characters not in _c_h_a_r_s. The matching string is
stored in the variable. If the character
immediately following the ^^^^ is a ]]]] then it is
treated as part of the set rather than the closing
bracket for the set.
The number of characters read from the input for a
conversion is the largest number that makes sense for that
particular conversion (e.g. as many decimal digits as
possible for %%%%dddd, as many octal digits as possible for %%%%oooo,
and so on). The input field for a given conversion
terminates either when a white-space character is
encountered or when the maximum field width has been
reached, whichever comes first. If a **** is present in the
conversion specifier then no variable is assigned and the
next scan argument is not consumed.
DDDDIIIIFFFFFFFFEEEERRRREEEENNNNCCCCEEEESSSS FFFFRRRROOOOMMMM AAAANNNNSSSSIIII SSSSSSSSCCCCAAAANNNNFFFF
The behavior of the ssssccccaaaannnn command is the same as the behavior
Page 2 (printed 7/17/95)
ssssccccaaaannnn((((nnnn)))) TTTTccccllll (((( )))) ssssccccaaaannnn((((nnnn))))
of the ANSI C ssssssssccccaaaannnnffff procedure except for the following
differences:
[1] %%%%pppp and %%%%nnnn conversion specifiers are not currently |
supported.
[2] For %%%%cccc conversions a single character value is
converted to a decimal string, which is then assigned
to the corresponding _v_a_r_N_a_m_e; no field width may be
specified for this conversion.
[3] The llll, hhhh, and LLLL modifiers are ignored; integer values |
are always converted as if there were no modifier |
present and real values are always converted as if the |
llll modifier were present (i.e. type ddddoooouuuubbbblllleeee is used for |
the internal representation).
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
conversion specifier, parse, scan
Page 3 (printed 7/17/95)